<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pm="http://primefaces.org/mobile"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	xmlns:b="http://bootsfaces.net/ui"
	template="/templates/layout_mb.xhtml">

	<ui:define name="pcontent">
		<b:well>
			<h:form id="frm1">
				<p:growl id="msgs" showDetail="true" />
				<h:outputText value="合同名称：" />
				<p:inputText value="#{mobileRptInfoMB.selectedContract.name}"
					disabled="true" style="margin-bottom:10px" />
				<br />
				<h:outputText value="产品：" />
				<p:selectOneMenu value="#{mobileRptInfoMB.selectedContProd}"
					converter="bmeContProdConverter" effect="fade"
					style="width:60%;margin-bottom:10px;" panelStyle="width:220px"
					var="t" required="true"
					requiredMessage="产品名称必须输入"  converterMessage="转化错误"  validatorMessage="验证错误">

					<p:ajax update="prodnum"
						listener="#{mobileRptInfoMB.onSelectBmeMaterial}" />
					<f:selectItems value="#{mobileRptInfoMB.bmeContProds}" var="item"
						itemLabel="#{item.bmeMaterial.id}" itemValue="#{item}" />

					<p:column headerText="产品编号">
						<h:outputText value="#{t.bmeMaterial.id}" />
					</p:column>
					<p:column headerText="产品描述">
						<h:outputText value="#{t.bmeMaterial.mdesc}" />
					</p:column>
				</p:selectOneMenu>
				<br />

				<h:outputText value="数量：" />
				<p:inputText id="prodnum"
					value="#{mobileRptInfoMB.bmeRptInfo.mquantity}"
					style="margin-bottom:10px" />
				<br />
				<h:outputText value="单价：" />
				<p:inputText id="prodprice"
					value="#{mobileRptInfoMB.bmeRptInfo.mprice}"
					style="margin-bottom:10px" />
				<br />
				<h:outputText value="金额：" />
				<p:inputText id="prodamount"
					value="#{mobileRptInfoMB.bmeRptInfo.amount}"
					style="margin-bottom:10px" />
				<br />
				<h:outputText value="单位：" />
				<p:inputText id="produnit"
					value="#{mobileRptInfoMB.bmeRptInfo.munit}"
					style="margin-bottom:10px" />
				<br />
				<h:outputText value="安装区域：" />
				<p:inputText id="prodarea"
					value="#{mobileRptInfoMB.bmeRptInfo.area}"
					style="margin-bottom:10px" />
				<br />
				<h:outputText value="安装费用：" />
				<p:inputText value="#{mobileRptInfoMB.bmeRptInfo.mamount}"
					style="margin-bottom:10px;" converterMessage="金额必须是数字类型" />
				<br />

				<h:outputText value="日期：" />
				<p:calendar id="signDate" locale="zh" navigator="true"
					value="#{mobileRptInfoMB.bmeRptInfo.endDate}" pattern="yyyy-MM-dd"
					mask="true" mode="popup" showOn="button" popupIconOnly="true"
					required="true" requiredMessage="日期必须输入" />
				<br />

				<h:panelGrid columns="3" cellspacing="30" styleClass="btnCenter"
					style="margin-top:10px">

					<p:commandButton id="btnQuery" value="提交" icon="ui-icon-check"
						action="#{mobileRptInfoMB.saveRptInfo}" update=":frm1:msgs"
						style="font-size:16px;color:white;background-color:#3366AA;">
					</p:commandButton>
					<p:button outcome="home_mb.xhtml" value="主页" icon="ui-icon-home"
						style="font-size:16px;color:white;background-color:#3366AA;" />

				</h:panelGrid>

				<p:panel id="panelUpload" style="margin-bottom:5px">
					<h:panelGrid columns="4" cellspacing="10">
						<h:panelGroup>
							<p:fileUpload
								fileUploadListener="#{mobileRptInfoMB.handleFileUpload}"
								mode="advanced" dragDropSupport="false" auto="true" label="附件选择"
								uploadLabel="文件上传" cancelLabel="取消上传" update=":frm1:panelUpload"
								sizeLimit="10000000" fileLimit="10"
								allowTypes="/(\.|\/)(gif|jpe?g|png|xml|pdf)$/"
								invalidFileMessage="不支持的文件类型" />
						</h:panelGroup>
						<p:graphicImage style="width:160px;height:90px;" title="#{mobileRptInfoMB.uploadedFile}" alt="附件图片" 
							value="/#{mobileRptInfoMB.uploadedFileImage}" />
					</h:panelGrid>
				</p:panel>
			</h:form>
		</b:well>
	</ui:define>

</ui:composition>